<template>
	<div id="myHeader">
		<input id="input_text" type="text" placeholder="回车添加内容" v-model="values" @keyup.enter="addItems" />
		<input type="button" value="添加" @click="addItems"/>
	</div>
</template>

<script>
	export default {
		name: 'MyHeader',
		data() {
			return {
				values: "",
			}
		},
		props: ['addData'],
		methods: {
			addItems() {
				if(!this.values.trim()){
					return
				}
				const a = {
					title: this.values,
					isFinish: false,
				}
				this.addData(a);
				this.values = '';
			}
		}
	}
</script>

<style>
	#myHeader {
		text-align: center;
	}

	#input_text {
		height: 30px;
		margin: 5px;
	}
</style>
